package com.atguigu.nio.zerocopy;

import java.io.DataInputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 使用传统的IO方法传递一个大文件
 */
// java IO 的服务器
public class OldIOServer {

    public static void main(String[] args) throws Exception {

        ServerSocket serverSocket = new ServerSocket(7001);

        while (true) {
            Socket socket = serverSocket.accept();
            DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());

            byte[] byteArray = new byte[4096];

            while (true) {
                int readCount = dataInputStream.read(byteArray, 0, byteArray.length);
                if (-1 == readCount) {
                    break;
                }
            }
        }
    }
}
